home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 188 / 01-04 PC Format 188 [2006-06] DVD side 1_.iso / DiscContents / Workshops / Workshops_Games / Gamer's Internet Tunnel / Git-099b4.exe / {app} / Generic IPX.git < prev    next >
Text File  |  2004-12-17  |  3KB  |  104 lines

  1. # GIT Wizard script Generic TCP or UDP game
  2.  
  3. # Base common settings
  4. setvar sockets "0000-ffff : All sockets"
  5. setvar ports ""
  6. setvar options OPT_FRAME_8022
  7. addflag options OPT_FRAME_8023
  8. addflag options OPT_COMP_ZLIB
  9. setvar packets PACKET_IPX
  10. setvar protos 0
  11.  
  12. # Page Asking for IP + Ask for a list of all others
  13. loadvar externalhostname
  14. loadvar servhostlist
  15. removeblanklines servhostlist
  16. sortlines servhostlist
  17. setvar heading "Host/IP List"
  18. setvar subheading "Information to provide to other LANs."
  19. addline control "label||What is your external hostname or IP address?"
  20. addline control "text1|externalhostname||4"
  21. addline control "label||You must provide this information to the person running GIT on each LAN now."
  22. addline control "space|||2"
  23. addline control "textm|servhostlist|Enter the hostname or IP each other person provides, one per line, including your own:|8"
  24. addline control "label||Everybody running GIT must have the all of the same hostnames or IPs listed here."
  25. showpage
  26. savevar externalhostname
  27. removeblanklines servhostlist
  28. sortlines servhostlist
  29. savevar servhostlist
  30.  
  31. setvar myhost externalhostname
  32.  
  33. # Must have at least two listed
  34. numlines numhosts servhostlist 
  35. if numhosts < 2
  36.     cancel "You must list at least your own host and one other."
  37. endif
  38.  
  39. # Figure out where in the list of hosts is ourself
  40. setvar myhostnum -1
  41. setvar i 0
  42. while i < numhosts
  43.     getline host servhostlist i
  44.     if host = myhost
  45.         setvar myhostnum i
  46.     endif
  47.     math i i + 1
  48. endwhile
  49.  
  50. # Make sure they listed themselves
  51. if myhostnum < 0
  52.     cancel "Your own hostname or IP was not found in the list."
  53. endif
  54.  
  55. # Loop through all the hosts and assign a port to each combination
  56. # Save all the ports/connections that involve ourself
  57. setvar port 213
  58. setvar hosts ""
  59. setvar portlist ""
  60. setvar i 0
  61. while i < numhosts
  62.     setvar j i
  63.     math j j + 1
  64.     while j < numhosts
  65.         setvar host ""
  66.         if i = myhostnum
  67.             getline host servhostlist j
  68.         endif
  69.         if j = myhostnum
  70.             getline host servhostlist i
  71.         endif
  72.         if host != ""
  73.             appendstring host ":"
  74.             appendstring host port
  75.             appendstring host METH_UDP
  76.             addline hosts host
  77.             addline portlist port
  78.         endif
  79.         math j j + 1
  80.         math port port + 1
  81.     endwhile
  82.     math i i + 1
  83. endwhile
  84.  
  85. # Show a reminder page listing ports to map
  86. setvar heading "Reminder"
  87. setvar subheading "Ports to map"
  88. # Create a nice string out of the list of ports
  89. removeblanklines portlist
  90. numlines i portlist
  91. if i > 1
  92.     math i i - 1
  93.     getline port portlist i
  94.     prependstring port "and "
  95.     setline portlist i port
  96. endif
  97. joinlines portlist ", "
  98. addline control "label||Reminder: If you are running a firewall or using NAT, you must map port "
  99. appendstring control portlist
  100. appendstring control " from "
  101. appendstring control externalhostname
  102. appendstring control " to the computer running GIT.|2"
  103. showpage
  104.